//This file contains all the global variables required for this project.

#define FU_ADDER 1
#define FU_MULTIPLIER 2
#define FU_DIVIDER 3
#define FU_LOADSTORE 4
#define FU_LOGICAL 5

#define IF_QUEUE 1
#define ID_QUEUE 2
#define IS_QUEUE 3
#define ROB_QUEUE 4
#define ADDER1_QUEUE 5
#define ADDER2_QUEUE 6
#define MULTIPLIER_QUEUE 7
#define DIVIDER_QUEUE 8
#define DEFAULT_QUEUE 9
#define LOADER_QUEUE 10
#define STORE_QUEUE 11
#define STORE_PREQUEUE 12

#define IF_BUFFERLIMIT 200
#define ID_BUFFERLIMIT 200
#define IS_BUFFERLIMIT 200
#define ROB_BUFFERLIMIT 200
#define NO_ADDRESS_FU 2
#define ADDER_RES_STATION 10
#define MULTIPLIER_RES_STATION 10
#define DIVIDER_RES_STATION 10
#define NO_BRANCH_FU 1

#define IF_CYCLE 1 
#define ADDER_CYCLE 2
#define MULTIPLIER_CYCLE 4
#define DIVIDER_CYCLE 12
#define DEFAULT_CYCLE 1
#define MEMORY_CYCLE 10
#define LOAD_CYCLE 10
#define STORE_CYCLE 10

#define RESSTATION_ADDER1 10
#define RESSTATION_ADDER2 10
#define RESSTATION_MULTIPLIER 10
#define RESSTATION_DIVIDER 10
#define RESSTATION_DEFAULT 10
#define RESSTATION_LOADER 10
#define RESSTATION_STORE 10

#define DISASSEMBLE "Disassemble::"
#define DIS_LENGTH strlen(DISASSEMBLE)
#define ADDRESS "INSAddress::"
#define ADDRESS_LENGTH strlen(ADDRESS)
#define READREGMAX "R_Reg::"
#define READREGMAX_LENGTH strlen(READREGMAX)
#define WRITEREGMAX "W_RegMax::"
#define WRITEREGMAX_LENGTH strlen(WRITEREGMAX)
#define MEMCOUNT "Mem::"
#define MEMCOUNT_LENGTH strlen(MEMCOUNT)
#define READ_CHECK "R:"
#define READ_LENGTH strlen(READ_CHECK)
#define WRITE_CHECK "W:"
#define WRITE_LENGTH strlen(WRITE_CHECK)

#define DWORDPTR "dword ptr ["
#define DWORDPTR_LENGTH strlen(DWORDPTR)
#define BYTEPTR "byte ptr ["
#define BYTEPTR_LENGTH strlen(BYTEPTR)
#define PTR "ptr ["
#define PTR_LENGTH strlen(PTR)

#define MNEMONIC_V 1
#define ADDRESS_V 2
#define RMAX_V 3
#define WMAX_V 4
#define MEMCOUNT_V 5
#define INSTRUCTION_V 6

//Cache - Parameters
#define L1ICACHE_SIZE 64*1024
#define L1ICACHE_ASSOCIATIVITY 8
#define L1ICACHE_BLOCKSIZE 64
#define L1DCACHE_SIZE 64*1024
#define L1DCACHE_ASSOCIATIVITY 8
#define L1DCACHE_BLOCKSIZE 64
#define L1_CYCLE 1

#define L2CACHE_SIZE 64*1024
#define L2CACHE_ASSOCIATIVITY 1
#define L2CACHE_BLOCKSIZE 64
#define L2_CYCLE 20
#define L2_MISS 100

#define I_TLB_SIZE 64
#define I_TLB_ASSOCIATIVITY I_TLB_SIZE
#define I_TLB_CYCLE 2
#define D_TLB_SIZE 64
#define D_TLB_ASSOCIATIVITY D_TLB_SIZE
#define D_TLB_CYCLE 2

#define TLB_INSTR 1
#define TLB_DATA 2
#define L1_INSTR 1
#define L1_DATA 2
#define TLB_MAGICNO 2000

#define PAGESIZE 4096
#define VA_BITS 32

#ifndef _global_h
#define _global_h
int IF_CURRENT_SIZE = 0;
int ID_CURRENT_SIZE = 0;
int IS_CURRENT_SIZE = 0;
int ROB_CURRENT_SIZE = 0;
int ROB_PREV_NO = 0;

//I will basically set it to 1, when its running.. Set it back to 0 when its done..
// 0 - Free, 1 - busy..
int ADDER1 = 0;
int ADDER2 = 0;
int ADDER1_CURRENT_SIZE = 0;
int ADDER2_CURRENT_SIZE = 0;
int LOADER_CURRENT_SIZE = 0;
int STORE_CURRENT_SIZE = 0;
int MULTIPLIER_CURRENT_SIZE = 0;
int DIVIDER_CURRENT_SIZE = 0;
int DEFAULT_CURRENT_SIZE = 0;
int STORE_PRE_CURRENT_SIZE = 0;

//Variables for profiling..
unsigned long long PROFILE_ADDER = 0;
unsigned long long PROFILE_MULTIPLIER = 0;
unsigned long long PROFILE_DIVIDER = 0;
unsigned long long PROFILE_LOADSTORE = 0;
unsigned long long PROFILE_LOGICAL = 0;
unsigned long long PROFILE_DEFAULT = 0;

//TLB
unsigned int I_TLB_COUNT = 0;
unsigned int D_TLB_COUNT = 0;
unsigned int I_TLB_VAL = 0;
unsigned int D_TLB_VAL = 0;

//Cache
unsigned long int NO_OF_SETS_L1_I = 0;
unsigned long int NO_OF_SETS_L1_D = 0;
unsigned long int NO_OF_SETS_L2 = 0;
unsigned int I_L1_VAL = 0;
unsigned int D_L1_VAL = 0;
unsigned int L2_VAL = 0;

unsigned int L1_I_BLOCKOFFSET = 0;
unsigned int L1_D_BLOCKOFFSET = 0;
unsigned int L1_I_INDEXBITS = 0;
unsigned int L1_D_INDEXBITS = 0;
unsigned int L2_BLOCKOFFSET = 0;
unsigned int L2_INDEXBITS = 0;

unsigned int L1_I_CACHE_MAGICNO = 0;
unsigned int L1_D_CACHE_MAGICNO = 0;
unsigned int L2_CACHE_MAGICNO 	= 0;
#endif
